using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using HISModels.Entities;

namespace HISModels.Mapping
{
	public class RelativeMap : EntityTypeConfiguration<Relative>
	{
		public RelativeMap()
		{
			// Primary Key
			this.HasKey(t => t.Id);

			// Properties
			this.Property(t => t.FirstName)
				.HasMaxLength(50);
				
			this.Property(t => t.LastName)
				.HasMaxLength(50);
				
			this.Property(t => t.PhoneNumber)
				.HasMaxLength(50);
				
			this.Property(t => t.MobilePhoneNumber)
				.HasMaxLength(50);
				
			this.Property(t => t.Email)
				.HasMaxLength(50);
				
			// Table & Column Mappings
			this.ToTable("Relatives");
			this.Property(t => t.Id).HasColumnName("Id");
			this.Property(t => t.PatientRelativeId).HasColumnName("PatientRelativeId");
			this.Property(t => t.FirstName).HasColumnName("FirstName");
			this.Property(t => t.LastName).HasColumnName("LastName");
			this.Property(t => t.BirthDate).HasColumnName("BirthDate");
			this.Property(t => t.PhoneNumber).HasColumnName("PhoneNumber");
			this.Property(t => t.MobilePhoneNumber).HasColumnName("MobilePhoneNumber");
			this.Property(t => t.Email).HasColumnName("Email");
			this.Property(t => t.Note).HasColumnName("Note");
		}
	}
}

